Skip to content

BUG: Handling NaN case before dtype conversion #40638 #41027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

Sudomarko
Copy link

@Sudomarko Sudomarko commented Apr 19, 2021

@pep8speaks
Copy link

pep8speaks commented Apr 19, 2021

Hello @Sudomarko! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-04-19 03:59:09 UTC

@Sudomarko Sudomarko marked this pull request as ready for review April 19, 2021 06:01
Copy link
Member

@mzeitlin11 mzeitlin11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pr @Sudomarko. First thing any pr needs is tests to make sure the changes actually work (which would catch the issues currently here).

In general, not sure why you're changing the method of filling missing values. That existing logic should be fine.


if (copy or na_value is not lib.no_default) and result is self._ndarray:
if na_value is not lib.no_default:
temp.fillna(method="bfill")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bfill? Also, this line won't have any effect anyway because inplace=False by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And na_value is no longer being used to fill

@@ -355,9 +355,14 @@ def to_numpy( # type: ignore[override]
copy: bool = False,
na_value=lib.no_default,
) -> np.ndarray:
result = np.asarray(self._ndarray, dtype=dtype)
temp = self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason for another temporary array, can just use result

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label May 20, 2021
@simonjayhawkins
Copy link
Member

@Sudomarko closing as stale. ping when ready to continue and i'll re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: PandasArray.to_numpy mishandles na_value
4 participants